package coredto

import (
	"core/coreinfo"
	"core/corestruct"
	"core/coreutil"
	"reflect"
)

type TreeViewNode struct {
	Id int64 `json:"id,string"                         gorm:"column:id;primaryKey;comment:主键;autoIncrement:false;"`

	Pid         int64           `json:"pid,string"                       gorm:"column:pid;DEFAULT:0;not null;comment:父编号;"`
	Code        string          `json:"code"         validate:"max=50"   gorm:"column:code;size:50;DEFAULT:'';not null;comment:菜单代码;"`
	Name        string          `json:"name"         validate:"required,max=50"gorm:"column:name;size:50;DEFAULT:'';not null;comment:菜单名称;"`
	Lx          string          `json:"lx"           validate:"max=10"   gorm:"column:lx;size:10;DEFAULT:'';not null;comment:类型;memo:目录、菜单、权限;"`
	Imgurl      string          `json:"imgurl"                           gorm:"column:imgurl;DEFAULT:'';not null;comment:图标;"`
	P1          string          `json:"p1"           validate:"max=50"   gorm:"column:p_1;size:50;DEFAULT:'';not null;comment:参数1;"`
	P2          string          `json:"p2"           validate:"max=50"   gorm:"column:p_2;size:50;DEFAULT:'';not null;comment:参数2;"`
	P3          string          `json:"p3"           validate:"max=50"   gorm:"column:p_3;size:50;DEFAULT:'';not null;comment:参数3;"`
	P4          string          `json:"p4"           validate:"max=50"   gorm:"column:p_4;size:50;DEFAULT:'';not null;comment:参数4;"`
	Expanded    bool            `json:"expanded"                         gorm:"column:expanded;not null;comment:Expanded;"`
	HasChildren bool            `json:"hasChildren"                      gorm:"column:has_children;not null;comment:HasChildren;"`
	Children    *[]TreeViewNode `json:"children"                         gorm:"-;comment:children;"`
	Obj         string          `json:"obj"                              gorm:"column:obj;DEFAULT:'';not null;comment:Obj;"`
}

func TreeViewNodeInit() {
	var mcls = &TreeViewNode{}
	var m = &corestruct.MyClass{
		Name:     "树形结构Dto",
		Ename:    "",
		FullName: "",
		Memo:     "",
		Fileds:   nil,
		PrjName:  coreinfo.PRJ_NAME,
		Type:     reflect.TypeOf(mcls),
	}
	coreutil.StructUtil.AddDto(m)
}
